<?php
/**
 * Created by JetBrains PhpStorm.
 * User: adilet
 * Date: 14.08.13
 * Time: 11:17
 * To change this template use File | Settings | File Templates.
 */

class Tourism_Form_Admin_Climate extends Engine_Form
{
    public function init()
    {

        $this
            ->setAttrib('class', 'global_form')
            ->setTitle('Add about the climate')
            ->setDescription('There is you can add about the climate.');


        $this->addElement('Text', 'title', array(
            'label' => 'Title',
            'allowEmpty' => false,
            'required' => true,
            'validators' => array(
                array('NotEmpty', true),
                array('StringLength', false, array(1, 64)),
            ),
            'filters' => array(
                'StripTags',
                new Engine_Filter_Censor(),
            ),
        ));

        $this->addElement('TinyMce', 'description', array(
            'disableLoadDefaultDecorators' => true,
            //'order' => 1,
            'required' => true,
            'editorOptions' => array(
                'bbcode' => true,
                'html' => true,
            ),
            'allowEmpty' => false,
            'decorators' => array(
                'ViewHelper',
                'Label',
                array('HtmlTag', array('style' => 'display: block;'))),
            'filters' => array(
                new Engine_Filter_HtmlSpecialChars(),
                new Engine_Filter_Censor(),
                new Engine_Filter_EnableLinks(),
            ),
        ));

        $this->addElement('File', 'photo', array(
            'label' => 'Photo',
            'destination' => APPLICATION_PATH.'/public/temporary/',
            'multiFile' => 1,
            'validators' => array(
                array('Count', false, 1),
                array('Extension', false, 'jpg,jpeg,png,gif'),
            )
        ));

        // Buttons
        $this->addElement('Button', 'submit', array(
            'label' => 'Save Changes',
            'type' => 'submit',
            'ignore' => true,
            'decorators' => array('ViewHelper')
        ));
    }
}